<?php
class LuminousGrammarCSS extends LuminousGrammar
{


  function __construct()
  {
    
    $this->SetInfoAuthor( 
    array('name'=>'Mark Watkinson', 'email'=>'markwatkinson@gmail.com',
    'website'=>'http://www.asgaard.co.uk'));
    $this->SetInfoLanguage('css');
    $this->SetInfoVersion('0.4.0');        
    
    $this->delimited_types = array(
      luminous_generic_comment('/*', '*/'),
      luminous_generic_string("'", "'"),
      luminous_generic_string("\"", "\"")
      );
      
    
      
    $this->simple_types = array(  
      new LuminousSimpleRule(3, 'KEYWORD', LUMINOUS_REGEX,
      '/@import/'),
      new LuminousSimpleRule(3, 'KEYWORD', LUMINOUS_REGEX,
      "/(?<=^|\}|>)([\s]*)(@?[a-z0-9_\-\s \t\.#:,\+]*?)(\{)/si", null, 2),
      new LuminousSimpleRule(4, 'VARIABLE', LUMINOUS_REGEX,
        '/(?<=\s)!important/'),
      new LuminousSimpleRule(1, 'NUMERIC', LUMINOUS_REGEX,
      '/(
        \#[a-fA-F0-9]{3,6}
        |
        (?<!\w)\d+(\.\d+)?(em|px|ex|ch|mm|cm|in|pt|%)?
        )/x'),
      new LuminousSimpleRule(3, 'FUNCTION', LUMINOUS_REGEX,
        '/\b(url|rgba?)(?=\()/'),      
      new LuminousSimpleRule(2, "TYPE", LUMINOUS_REGEX, 
      "/[a-zA-Z\-]+[\s]*(?=[:])/"),
      new LuminousSimpleRule(2, "VALUE", LUMINOUS_REGEX, 
        "/(?<=[:])[\s]*.+?(?=[;\}$])/s"),


      
      new LuminousSimpleRuleList(4, "OPERATOR", 0, 
        array(':', '#', '.', '{', '}'))
      );
      
      
  }
}


class LuminousGrammarCSSEmbedded extends LuminousGrammarCSS
{

  function __construct()
  {
    $this->ignore_outside = array(
      new LuminousBoundaryRule(LUMINOUS_REGEX|LUMINOUS_EXCLUDE, 
      "/(&lt;style.*?&gt;)/si", "/(&lt;\/style&gt;)/si")
      );
    $this->child_grammar = new LuminousGrammarHTML();
   
    parent::__construct();
    $this->SetInfoAuthor( 
    array('name'=>'Mark Watkinson', 'email'=>'markwatkinson@gmail.com',
    'website'=>'http://www.asgaard.co.uk'));
    $this->SetInfoVersion('0.4.0');          
  }
}